﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MTViewer
{
    /// <summary>
    /// Interaction logic for PanelButton.xaml
    /// </summary>
    public partial class PanelButton : UserControl//, ITouchObject
    {
        public event EventHandler OnClick;

        public PanelButton()
        {
            InitializeComponent();
            //DataContext = this;
        }

        public static DependencyProperty CauseNameProperty = DependencyProperty.RegisterAttached("CauseName", typeof(string), typeof(PanelButton), null);

        public static string GetCauseName(UIElement element)
        {
            return (string)element.GetValue(CauseNameProperty);
        }

        public static void SetCauseName(UIElement element, string value)
        {
            element.SetValue(CauseNameProperty, value);
        }

        string cause_name;

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (OnClick != null)
            {
                OnClick(this, null);
            }

            //SASServiceReference.SasLogicClient cl = new CapMatrix.SASServiceReference.SasLogicClient();

            //cl.GetDataCompleted += new EventHandler<CapMatrix.SASServiceReference.GetDataCompletedEventArgs>(cl_GetDataCompleted);
            //cl.GetDataAsync(123);
            //cl.GetCECompleted += new EventHandler<CapMatrix.SASServiceReference.GetCECompletedEventArgs>(cl_GetCECompleted);
            //cl.GetCEAsync("42%1106%", CapMatrix.SASServiceReference.SasCEReportTypes.CauseEffects, null);

            //<Access-policy>
            //Button btn = (Button)sender;
            //Ellipse el = (Ellipse)btn.Content;
            //cause_name = GetCauseName(this);
            //FormManager mngr = App.FloatableWindowManager;
            //mngr.Show(cause_name);
        }

        //void cl_GetDataCompleted(object sender, CapMatrix.SASServiceReference.GetDataCompletedEventArgs e)
        //{
        //    string ss = e.Result;
        //}

        //void cl_GetCECompleted(object sender, CapMatrix.SASServiceReference.GetCECompletedEventArgs e)
        //{
        //    CapMatrix.SASServiceReference.GetCEResponseGetCEResult res = e.Result;
        //    //throw new NotImplementedException();
        //}



        //public string ImagePath
        //{
        //    get { return (string)GetValue(ImagePathProperty); }
        //    set { SetValue(ImagePathProperty, value); }
        //}

        //public double Angle
        //{
        //    get { return (double)GetValue(AngleProperty); }
        //    set { SetValue(AngleProperty, value); }
        //}

        //public double ScaleX
        //{
        //    get { return (double)GetValue(ScaleXProperty); }
        //    set { SetValue(ScaleXProperty, value); }
        //}

        //public double ScaleY
        //{
        //    get { return (double)GetValue(ScaleYProperty); }
        //    set { SetValue(ScaleYProperty, value); }
        //}

        //public double X
        //{
        //    get { return (double)GetValue(XProperty); }
        //    set { SetValue(XProperty, value); }
        //}

        //public double Y
        //{
        //    get { return (double)GetValue(YProperty); }
        //    set { SetValue(YProperty, value); }
        //}

        //public string PdfFileName
        //{
        //    get { return (string)GetValue(PdfFileNameProperty); }
        //    set { SetValue(PdfFileNameProperty, value); }
        //}

        //public string OriginalImagePath
        //{
        //    get { return (string)GetValue(OriginalImagePathProperty); }
        //    set { SetValue(OriginalImagePathProperty, value); }
        //}

        //#region DependencyProperties

        //// Using a DependencyProperty as the backing store for ImagePath.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty ImagePathProperty =
        //    DependencyProperty.Register("ImagePath", typeof(string), typeof(PanelButton), new UIPropertyMetadata(""));

        //// Using a DependencyProperty as the backing store for Angle.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty AngleProperty =
        //    DependencyProperty.Register("Angle", typeof(double), typeof(PanelButton), new UIPropertyMetadata(0.0));

        //// Using a DependencyProperty as the backing store for ScaleX.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty ScaleXProperty =
        //    DependencyProperty.Register("ScaleX", typeof(double), typeof(PanelButton), new UIPropertyMetadata(1.0));

        //// Using a DependencyProperty as the backing store for ScaleY.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty ScaleYProperty =
        //    DependencyProperty.Register("ScaleY", typeof(double), typeof(PanelButton), new UIPropertyMetadata(1.0));

        //// Using a DependencyProperty as the backing store for X.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty XProperty =
        //    DependencyProperty.Register("X", typeof(double), typeof(PanelButton), new UIPropertyMetadata(0.0));

        //// Using a DependencyProperty as the backing store for Y.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty YProperty =
        //    DependencyProperty.Register("Y", typeof(double), typeof(PanelButton), new UIPropertyMetadata(0.0));

        //// Using a DependencyProperty as the backing store for ImagePath.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty PdfFileNameProperty =
        //    DependencyProperty.Register("PdfFileName", typeof(string), typeof(PanelButton), new UIPropertyMetadata(""));

        //// Using a DependencyProperty as the backing store for ImagePath.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty OriginalImagePathProperty =
        //    DependencyProperty.Register("OriginalImagePath", typeof(string), typeof(PanelButton), new UIPropertyMetadata(""));
        //#endregion

    }
}
